package com.zlfund.cat.zjgsmk.util.filepick;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenj on 2017/9/26 0026.
 */

public class TypeFileFilter implements IFileFilterService {

    private List<String> mSuffixes;

    public TypeFileFilter(){
        mSuffixes = new ArrayList<>();
    }

    @Override
    public boolean filterFile(File file) {
        String name = file.getName();
        for (String suffix : mSuffixes) {
            if (name.contains(suffix)){
                return false;
            }
        }
        return true;
    }

    public void addFileSuffix(String suffix){
        mSuffixes.add(suffix);
    }
}
